home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #3 / Amiga Plus CD - 1996 - No. 3.iso / demo-versionen / databaseprofessional_v3.0 / clipart / overview.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-27  |  5KB  |  228 lines

  1. /* Overview.rexx (ClipArt Version), 26.08.95 Jörg Richter */
  2.  
  3. ARG book
  4.  
  5. OPTIONS RESULTS
  6.  
  7. thumbsize = 140
  8.  
  9. ADDRESS DataBase
  10.  
  11. GetMaskSize
  12. size = result
  13. width = WORD(size,1)
  14. height = WORD(size,2)
  15.  
  16. xoff = (width-((width%thumbsize)*thumbsize))%2
  17. yoff = 30
  18.  
  19. LoadGadgets "Clipart/IdxGadgets/"
  20. Display Off
  21.  
  22. doit = 1
  23. stext = "Bitte wählen Sie ..."
  24.  
  25. DO FOREVER
  26.   IF doit = 1 THEN DO
  27.     Current
  28.     nr = result
  29.     CALL Overview
  30.   END
  31.   WaitCommand stext
  32.   command = result
  33.   stext = "Bitte wählen Sie ..."
  34.   doit = 0
  35.   IF WORDS(command) > 1 THEN DO
  36.     mx = WORD(command,1)
  37.     my = WORD(command,2)
  38.     qual = WORD(command,3)
  39.     Current
  40.     ds = result
  41.     IF qual = 10 THEN DO /* Gadget */
  42.       IF mx = 1 THEN DO /* <- */
  43.         command = 79
  44.       END
  45.       IF mx = 2 THEN /* -> */
  46.         command = 78
  47.       IF mx = 9 THEN DO /* Abbruch */
  48.         Goto nr
  49.         Call Cancel
  50.       END
  51.       IF mx > 2 & mx < 8 THEN DO
  52.         WaitCommand "Bitte wählen Sie das Bild aus ..."
  53.         command = result
  54.         IF WORDS(command) > 1 THEN DO
  55.           IF mx = 3 THEN qual = 0
  56.           IF mx = 4 THEN qual = 2
  57.           IF mx = 5 THEN qual = 3 /* DTP */
  58.           IF mx = 6 THEN qual = 9 /* Info */
  59.           IF mx = 7 THEN qual = 1
  60.           mx = WORD(command,1)
  61.           my = WORD(command,2)
  62.         END
  63.       END /* IF mx > 2 */
  64.       IF mx = 8 THEN command = 95 /* Inhalt */
  65.     END /* IF qual = 10 */
  66.     IF qual < 10 THEN DO
  67.       my = my - ((my-yoff)%thumbsize)*10
  68.       select = nr + (mx-xoff)%thumbsize + ((my-yoff)%thumbsize)*(width%thumbsize)
  69.       Goto select
  70.       SELECT
  71.         WHEN qual = 0 THEN
  72.           Execute 1
  73.         WHEN qual = 1 THEN DO /* SHIFT */
  74.           Call Cancel
  75.           END
  76.         WHEN qual = 2 THEN DO /* CTRL */
  77.           p1 = (mx-xoff)%thumbsize
  78.           p2 = (my-yoff)%thumbsize
  79.           Mark
  80.           IF RC = 5 THEN DO
  81.             BoxFill p1*thumbsize+xoff+thumbsize-8 p2*thumbsize+yoff+10*(p2+1)-4 5 5 1
  82.             stext = "Clip markiert"
  83.             END
  84.           ELSE DO
  85.             BoxFill p1*thumbsize+xoff+thumbsize-8 p2*thumbsize+yoff+10*(p2+1)-4 5 5 2
  86.             stext = "Clip demarkiert"
  87.             END
  88.           END
  89.         WHEN qual = 3 THEN DO /* AMIGA */
  90.           GetData $F1
  91.           data = result
  92.           pos = LastPos("/",data)
  93.           CopyToClip LEFT(data,pos) || D2C(10) || SubStr(data,pos+1,Length(data)-pos)
  94.           stext = " Clipname ins Klemmbrett kopiert"
  95.           END
  96.         WHEN qual = 9 THEN DO /* Info */
  97.           GetData $F2
  98.           fsize = result
  99.           GetData $F3
  100.           psize = result
  101.           stext = "Dateilänge: " || fsize || " KBytes     Bildgröße: " || psize
  102.           END
  103.         OTHERWISE
  104.  
  105.       END /* SELECT */
  106.       Goto ds
  107.       command = 999
  108.     END /* IF qual < 10 */
  109.   END /* IF WORDS */
  110.   IF command = 27 | command = 0 THEN DO /* ESC */
  111.     Goto nr
  112.     Call Cancel
  113.     END
  114.   IF command = 79 THEN DO /* <- */
  115.     Current
  116.     ds = result
  117.     IF nr > 1 THEN DO
  118.       go = nr - (width%thumbsize)*(height%thumbsize)
  119.       IF go < 1 THEN go = 1
  120.       DO WHILE ds > go
  121.         LeftOne
  122.         ds = ds - 1
  123.         IF ds = nr-1 THEN DO
  124.           GetData $F4
  125.           old = result
  126.           pos = LastPos("/",old)
  127.           old = SubStr(old,1,pos)
  128.         END
  129.         IF ds < nr-1 THEN DO
  130.           GetData $F4
  131.           name = result
  132.           pos = LastPos("/",name)
  133.           IF COMPARE(SubStr(name,1,pos),old) ~= 0 THEN DO
  134.             ds = go
  135.             RightOne
  136.           END
  137.         END
  138.       END /* DO WHILE */
  139.       doit = 1
  140.     END /* IF nr > 1 */
  141.   END /* IF command = 79 */
  142.   IF command = 78 | command = 32 THEN /* -> */
  143.     doit = 1
  144.   IF command = 95 THEN DO /* HELP */
  145.     Display On
  146.     ADDRESS COMMAND 'SYS:Rexxc/Rx Clipart/Book ' || book
  147.     Display Off
  148.     doit = 1
  149.   END /* IF command = 95 */
  150. END /* DO FOREVER */
  151.  
  152. EXIT
  153.  
  154.  
  155. ShowPicture:
  156.  
  157. ARG xx yy .
  158.  
  159. GetData $F4
  160. name = result
  161. pos = LastPos("/",name)
  162. IF COMPARE(SubStr(name,1,pos),old) ~= 0 THEN DO
  163.   x = width
  164.   y = height
  165.   LeftOne
  166.   END
  167. ELSE DO
  168.   LoadPic name xx yy CENTER
  169.   Box xx+13 yy+13 124 124 1
  170.   SetFont helvetica.font 11 0
  171.   Text xx+12 yy+11 1 UPPER(SubStr(name,pos+1,Length(name)-pos))
  172.   SetFont RESET 0
  173.   IsMarked
  174.   IF RC = 0 THEN
  175.     BoxFill xx+thumbsize-8 yy+6 5 5 1
  176. END
  177.  
  178. RETURN
  179.  
  180.  
  181. Overview:
  182.  
  183. x = xoff
  184. y = yoff
  185. GetData $F1
  186. title = result
  187. pos = LastPos("/",title)
  188. BoxFill 1 1 width-1 height-1 2
  189. SetFont Helvetica.font 15 0
  190. Text xoff+13 20 1 SubStr(title,1,pos-1)
  191. SetFont RESET 0
  192. Line xoff+13 23 width-xoff-38 0 1
  193. GetData $F4
  194. old = result
  195. pos = LastPos("/",old)
  196. old = SubStr(old,1,pos)
  197.  
  198. weiter = 1
  199.  
  200. DO WHILE weiter = 1
  201.  
  202.   CALL ShowPicture x y
  203.   x = x + thumbsize
  204.   IF x > width-thumbsize THEN DO
  205.     IF y < height-(thumbsize*2) THEN DO
  206.       x = xoff
  207.       y = y + thumbsize + 10
  208.       END
  209.     ELSE
  210.       weiter = 0
  211.     END
  212.   RightOne
  213.   IF RC ~= 0 THEN
  214.     weiter = 0
  215.  
  216. END
  217.  
  218. RETURN
  219.  
  220.  
  221. Cancel:
  222.  
  223. Display On
  224. LoadGadgets RESET
  225. Show NEW
  226. EXIT
  227.  
  228.